import { queryGodCategoryZtreeAsyn } from '@/api/admin.api'
export const formOptions = [
  {
    label: '商品目录',
    type: 'cascader',
    key: 'category',
    span: 6,
    props: {
      placeholder: '请选择',
      filterable:true,
      clearable:true,
      props: {
        checkStrictly: true,
        lazy: true,
        lazyLoad (node, resolve) {
          const { level } = node
          queryGodCategoryZtreeAsyn(node&&node.value?node.value:"",'1').then((res) => {
            const nodes = res.map((categoty) => ({
                    value: categoty.id,
                    label: categoty.categoryName,
                    leaf: level >= 2
                  }))
            resolve(nodes)
          })
        }
      }
    }
  },
  {
    label: '商品状态',
    type: 'select',
    key: 'goodsState',
    span: 6,
    props: {
      clearable:true,
      placeholder: '请选择'
    },
    options: [
      {
        label: '新提交',
        value: 'COMMIT'
      },
      {
        label: '审核通过',
        value: 'PASS'
      },
      {
        label: '退回修改',
        value: 'RETURN'
      },
      {
        label: '商品下架',
        value: 'DOWN'
      }
    ]
  },
  {
    label: '商品名称',
    type: 'input',
    key: 'goodsName',
    span: 6,
    props: {
      placeholder: '请输入商品名称'
    }
  },
  {
    label: '品牌',
    type: 'input',
    key: 'brandName',
    span: 6,
    props: {
      placeholder: '请输入品牌'
    }
  },
  {
    label: '规格型号',
    type: 'input',
    key: 'typeNo',
    span: 6,
    props: {
      placeholder: '请输入规格型号'
    }
  },
  {
    label: '供应商名称',
    type: 'input',
    key: 'supplierName',
    span: 6,
    props: {
      placeholder: '请输入供应商名称'
    }
  },
  {
    label: '扶贫商品',
    type: 'select',
    key: 'isAid',
    span: 6,
    props: {
      clearable:true,
      placeholder: '请选择'
    },
    options: [
      {
        label: '否',
        value: '0'
      },
      {
        label: '是',
        value: '1'
      }
    ]
  },
  {
    label: 'sku',
    type: 'input',
    key: 'sku',
    span: 6,
    props: {
      placeholder: '请输入sku'
    }
  },
]

export const btns = [
  // 'insert',
  // 'update',
  // 'delete',
  // 'import',
  // 'export',
  {
    title: '批量审核通过',
    icon: 'check',
    event: 'on-approved',
    listeners:'approved'
  },
  {
    title: '批量退回',
    icon: 'back',
    event: 'on-back'
  },
  {
    title: '批量设置旗舰店上架',
    icon: 'setting',
    event: 'on-set'
  },
  {
    title: '批量取消旗舰店上架',
    icon: 'refresh',
    event: 'on-cancel'
  },
  {
    title: '批量上架',
    event: 'upAll'
  },
  {
    title: '批量下架',
    event: 'downAll'
  }
]
